package single;

/**
 * 饿汉式-最常用（类装载时就实例化-懒汉式是创建时才实例化）
 */
public class singleObj {
    private static singleObj singleObj = new singleObj();
    //构造函数private,防止类被实例化
    private singleObj(){}
    //获取唯一对象
    public static singleObj getInstance(){
        return singleObj;
    }
    public void show(){
        System.out.println("hello,single");
    }
}
